<?php
include "./config/fungsi_tampilan.php";


function data()
{
include "./config/koneksi.php";
		$DATA='';
		$NO=0;
		$query="select * from penjualan";
		$view= oci_parse($conn,$query);
		oci_execute($view);
		while($row=oci_fetch_array($view))
			{
				$idp= $row['ID_PEN'];
				$idpet= $row['ID_PET'];
				$idk= $row['ID_KON'];
				$idb= $row['ID_BAR'];
				$jml= $row['JML'];
				$tgl= $row['TGL'];
				$tgl= $row['TOTAL'];
				$NO= $NO+1;
				$DATA=	$DATA."
					<tr>														
						<td style='width:20px'>
							".$NO."
						</td>
						<td>".$idp."</td>
						<td>".$idpet."</td>
						<td>".$idk."</td>
						<td>".$idb."</td>
						<td>".$jml."</td>
						<td>".$tgl."</td>
						<td>
							<a class='ajax' href='datapenjualan_ubah.php?NIM=$idp' title='Powered by najamuddin dwi &copy; 2013'><i class='icon-pencil'></i></a>
							<a href='datapenjualan_hapus.php?NIM=$idp' ><i class='icon-trash'></i></a>
						</td>
					</tr>	
				";
			}
		
		return $DATA;
}

function combobox()
{
	include "./config/koneksi.php";
	$DATA='<select name="id_pet" >';
	$query="SELECT * FROM Petugas";
	$view= oci_parse($conn,$query);
	oci_execute($view);
	while($row=oci_fetch_array($view))
			{
				$DATA=$DATA.'<option value="'.$row[0].'">'.$row[1].'</option>';
				
			}
	$DATA=$DATA.'</select>';
	return $DATA;
}

function combobox2()
{
	include "./config/koneksi.php";
	$DATA='<select name="id_kon" >';
	$query="SELECT * FROM konsumen";
	$view= oci_parse($conn,$query);
	oci_execute($view);
	while($row=oci_fetch_array($view))
			{
				$DATA=$DATA.'<option value="'.$row[0].'">'.$row[1].'</option>';
				
			}
	$DATA=$DATA.'</select>';
	return $DATA;
}

function combobox3()
{
	include "./config/koneksi.php";
	$DATA='<select name="id_bar" >';
	$query="SELECT * FROM barang";
	$view= oci_parse($conn,$query);
	oci_execute($view);
	while($row=oci_fetch_array($view))
			{
				$DATA=$DATA.'<option value="'.$row[0].'">'.$row[2].'</option>';
				
			}
	$DATA=$DATA.'</select>';
	return $DATA;
}


//titile
$title="data penjualan";

$content='
				<div class="span12" style="margin-left:0px;">			
						<div style="margin:0px;align:center;font-size:15pt;margin-top:0px;margin-bottom:2px;padding-top: 4px; padding-bottom: 4px;" class="legend alert alert-info">
							<b>
							Form data penjualan
							</b>
						</div>
						<ul class="thumbnails row-fluid"  style="margin-bottom: 0px;">
							<li class="span12 thumbnail"  style="margin-bottom: 10px;margin-left:0px;" >
								<!--<a href="carddisplay.php?id=112">-->
									<div align="center" class="" 
										style="text-align:left;font-size:12pt;padding: 3px 3px 0px;margin-left:auto;margin-right:auto">
											<form name="tes" method="POST" action="datapenjualan_simpan.php">
												<table class="table" class="spand12" >
													<tr>
													
															<td>
																id penjualan
															</td>
															<td>
																<input type="text" name="id_penjualan" placeholder="masukkan id penjualanya ya.....">
															</td>
													</tr>
													<tr>
															<td>
																Nama Petugas
															</td>
															<td>
																'.combobox().'
																																										    
															</td>
													</tr>
													<tr>
															<td>
																Nama konsumen
															</td>
															<td>
																'.combobox2().'
														</td>
													</tr>
													<tr>
															<td>
																Nama barang
															</td>
															<td>
																'.combobox3().'
															</td>
													</tr>
													<tr>
															<td>
																Jumlah
															</td>
															<td>
																<input type="text" name="jumlah" placeholder="jumlah .....">
															</td>
													</tr>
													<tr>
															<td>
																Tanggal
															</td>
															<td>
																<input type="text" name="tgl" class="input-append date"  id="dp1" placeholder="tanggal .....">
																</td>
												</tr>
													<tr>
													
															<td>
																
															</td>
															<td>
																<button type="submit" class="btn btn-small btn-primary">SIMPAN</button></a>
														</td>
													</tr>
												</table>
											</form>		
											
									</div>
								<!--</a>-->
							</li>
						</ul>
					</div>
					<div class="span12" style="margin-left:0px;">			
							<div style="margin:0px;align:center;font-size:15pt;margin-top:0px;margin-bottom:2px;padding-top: 4px; padding-bottom: 4px;" class="legend alert alert-info">
								<b>
								Data penjualan
								</b>
							</div>
							<ul class="thumbnails row-fluid"  style="margin-bottom: 0px;">
								<li class="span12 thumbnail"  style="margin-bottom: 10px;margin-left:0px;" >
									<!--<a href="carddisplay.php?id=112">-->
										<div align="center" class="" 
										style="text-align:left;font-size:10pt;padding: 3px 3px 0px;margin-left:auto;margin-right:auto">
											<table class="table table-bordered table-striped table_vam" id="dt_gal">
												<thead>
													<tr>
														<th>No</th>
														<th>id penjualan</th>
														<th>id petugas</th>
														<th>id konsumen</th>
														<th>id barang</th>
														<th>jumlah</th>
														<th>tanggal</th>
														<th>ACTION</th>
													</tr>
												</thead>
												<tbody>
												'.data().'																									
												</tbody>
											</table>
										</div>
									<!--</a>-->
								</li>
							</ul>
					</div>									
	<div class="span12" style="margin-left:0px;">			
							<div style="margin:0px;align:center;font-size:15pt;margin-top:0px;margin-bottom:2px;padding-top: 4px; padding-bottom: 4px;" class="legend alert alert-info">
								<b>
								<center>"Administrasi yang baik Menjaga kepercayaan"</center>
								</b>
							</div>
							<ul class="thumbnails row-fluid"  style="margin-bottom: 0px;">
								<li class="span12 thumbnail"  style="margin-bottom: 10px;margin-left:0px;" >
									<!--<a href="carddisplay.php?id=112">-->
										<div align="center" class="" 
										style="text-align:left;font-size:10pt;padding: 3px 3px 0px;margin-left:auto;margin-right:auto">
											
										</div>
									<!--</a>-->
								</li>
							</ul>
					</div>					
					
				';


echo printPage($title,$content);
?>
